ServerEvents.recipes(event =>{
  //替换无法获得的物品或者另外写配方
  event.replaceInput({output:'goety:marble'},'minecraft:calcite','tfc:rock/cobble/marble')
  event.replaceInput({modid:'goety',type:'goety:ritual'},'minecraft:iron_pickaxe','tfc:metal/pickaxe/wrought_iron')
  event.replaceInput('goety:spider_nest','#forge:foods/meat/raw','minecraft:spider_eye')
  event.remove({output:'bloodmagic:sacrificialdagger'})
  event.replaceInput({output:'createoreexcavation:vein_finder'},'#forge:ores/redstone','goety:sensing_focus')
   //阴影石头(黑石)
   event.custom(
    {
      "type": "goety:cursed_infuser_recipes",
      "ingredient": {
        "item": "minecraft:blackstone"
      },
      "result": "goety:shade_stone",
      "cookingTime": 20
    })
  event.custom({//大理石
    "type": "goety:cursed_infuser_recipes",
    "ingredient": {
      "item": "tfc:rock/cobble/marble"
    },
    "result": "goety:marble",
    "cookingTime": 20
  })
  //狂风核心
  event.custom({
    "type": "goety:ritual",
    "ritual_type": "goety:craft",
    "activation_item": {
      "item": "goety:empty_focus"
    },
    "craftType": "sky",
    "soulCost": 1,
    "duration": 10,
    "ingredients": [
      {"item": "minecraft:feather"},
      { "tag": "forge:dusts/glowstone"},
      {"item": "minecraft:note_block"},
      {"item": "tfc:food/sugarcane"},
      {"tag": "tfc:compost_greens_low"}
    ],
    "result": {
      "item": "goety:wind_core",
      "count": 2
    }
    })
  //紫水晶母岩
  event.custom({
    "type": "goety:ritual",
    "ritual_type": "goety:craft",
    "activation_item": {
      "item": "minecraft:amethyst_block"
    },
    "craftType": "geoturgy",
    "soulCost": 1,
    "duration": 10,
    "ingredients": [
      {"item": "goety:quick_growing_seed"},
      {"item": "goety:magic_emerald"}
    ],
    "result": {
      "item": "minecraft:budding_amethyst",
      "count": 1
    }
  });
  //仪式匕首
  event.custom({
    "type": "goety:ritual",
    "ritual_type": "goety:craft",
    "activation_item": {
      "item": "goety:fanged_dagger"
    },
    "craftType": "magic",
    "soulCost": 1,
    "duration": 10,
    "ingredients": [
      {"item": "minecraft:ghast_tear"},
      {"item": "goety:magic_fabric"},
      {"item": "tfc:metal/sheet/rose_gold"},
      {"item": "tfc:metal/sheet/rose_gold"}
    ],
    "result": {
      "item": "bloodmagic:sacrificialdagger",
      "count": 1
    }
  });
  //召唤孤魂尸鬼
  event.custom({
    "type": "goety:ritual",
    "ritual_type": "goety:convert_tamed",
    "activation_item": {"item": "kubejs:gluttony"},
    "craftType": "sabbath",
    "entity_to_convert_into": "goety:wight",
    "soulCost": 50,
    "duration": 60,
    "research": "bygone",
    "ingredients": [
      {"item": "minecraft:ender_eye"},
      {"item": "minecraft:echo_shard"},
      {"item": "goety:ectoplasm"},
      {"item": "goety:dark_fabric"}
    ],
    "result": {"item": "kubejs:gluttony"},
    "conditions": [
      {"type": "forge:mod_loaded","modid": "ebs_wildfire"}
    ]
  });
  //召唤孤魂尸鬼
  event.custom({
    "type": "goety:ritual",
    "ritual_type": "goety:convert_tamed",
    "activation_item": {"item": "kubejs:gluttony"},
    "craftType": "sabbath",
    "entity_to_convert_into": "goety:wight",
    "soulCost": 20,
    "duration": 50,
    "research": "bygone",
    "ingredients": [
      {"item": "goety:shadow_essence"},
      {"item": "goety:ectoplasm"}
    ],
    "result": {"item": "kubejs:gluttony"},
    "conditions": [
      {"type": "forge:mod_loaded","modid": "ebs_wildfire"}
    ]
  });
  //召唤坚守者
  event.custom({
    "type": "goety:ritual",
    "ritual_type": "goety:convert_tamed",
    "activation_item": {"item": "goety:animation_core"},
    "craftType": "geoturgy",
    "entity_to_convert_into": "minecraft:warden",
    "soulCost": 50,
    "duration": 60,
    "research": "warred",
    "ingredients": [
      {"item": "goety:cursed_ingot"},
      {"item": "minecraft:note_block"},
      {"item": "goety:ectoplasm"},
      {"item": "goety:ectoplasm"}
    ],
    "result": {"item": "minecraft:sculk_shrieker"},
    "conditions": [
      {"type": "forge:mod_loaded","modid": "ebs_wildfire"}
    ]
  });
  event.replaceInput({output:'goety:magic_emerald'},'minecraft:emerald','#forge:gems/emerald')
  event.replaceInput({output:'goety:marble'},'minecraft:emerald','#forge:gems/emerald')
  //获得玉
  event.custom({
    "type": "goety:pulverize",
    "ingredient": [
      {
        "item": "minecraft:gold_block"
      }
    ],
    "block_result": "goety:jade_block"
  });
  event.custom({
    "type": "goety:pulverize",
    "ingredient": [
      {
        "item": "ae2:quartz_block"
      }
    ],
    "block_result": "goety:jade_ore"
  })
  event.custom({
    "type": "goety:pulverize",
    "ingredient": [
      {
        "item": "minecraft:weeping_vines"
      }
    ],
    "block_result": "minecraft:spore_blossom"
  })
  //诅咒金属锭
  event.replaceInput({output:'goety:cursed_ingot'},'minecraft:iron_ingot','tfc:metal/ingot/wrought_iron')
  //mobz金属锭
  event.custom(
  {
    "type": "goety:cursed_infuser_recipes",
    "ingredient": {
      "item": "tfc:metal/ingot/weak_steel"
    },
    "result": "mobz:hardened_metal_ingot",
    "cookingTime": 60
  });
  event.shaped('goety:pithos',[
    'ABA','BCB','ABA'
  ],{
    A:'goety:spirit_fabric',
    B:'goety:shade_stone_bricks',
    C:'goety:ectoplasm'
  });
  //灾厄宰相
    event.custom({
    "type": "goety:ritual",
    "ritual_type": "goety:convert_tamed",
    "activation_item": {"item": "goety:dark_scroll"},
    "craftType": "adept_nether",
    "entity_to_convert": {
      "tag": "minecraft.villager",
      "display_name": "entity.minecraft.villager"
    },
    "entity_to_convert_into": "goety:vizier",
    "soulCost": 50,
    "duration": 20,
    "ingredients": [
      {"item": "goety:soul_emerald"},
      {"item": "goety:soul_emerald"},
      {"item": "goety:ominous_shard"},
      {"item": "goety:ominous_shard"}],
    "result": {"item": "goety:jei_dummy/none"},
    "conditions": [
      {"type": "forge:mod_loaded","modid": "ebs_wildfire"}
    ]
  });
  //掠夺者首领
  event.custom(
    {
      "type": "goety:ritual",
      "ritual_type": "goety:convert_tamed",
      "activation_item": {
        "item": "minecraft:bone"
      },
      "craftType": "necroturgy",
      "entity_to_convert": {
        "tag": "minecraft.pillager",
        "display_name": "entity.minecraft.pillager"
      },
      "entity_to_convert_into": "mobz:pillager_boss",
      "soulCost": 1,
      "duration": 10,
      "ingredients": [
        {"item": "minecraft:coal"},
        {"item": "minecraft:coal"},
        {"item": "minecraft:coal"},
        {"item": "minecraft:coal"}],
      "result": {"item": "goety:jei_dummy/none"},
      "conditions":[
      {"type": "forge:mod_loaded","modid": "ebs_wildfire"}
    ]});
})
//育母蜘蛛
BlockEvents.rightClicked('goety:spider_nest',event =>{
  const{player,block,server}=event;
  const x=block.x;const y=block.y;const z=block.z;
  if(player.getMainHandItem() === 'goety:ectoplasm'){
    server.runCommandSilent(`setblock ${x} ${y} ${z} goety:spider_mother_den`)
    player.mainHandItem.setCount(player.mainHandItem.count-1)
    event.cancel()
  }
});
//巫婆
BlockEvents.rightClicked('goety:crystal_ball',event =>{
  const{player,block,server}=event;
  const x=block.x;const y=block.y;const z=block.z;
  if(player.getMainHandItem() === 'goety:soul_ruby'){
    server.runCommandSilent(`setblock ${x} ${y} ${z} goety:crystal_ball`)
    event.cancel()
  }
});
//骷髅领主
BlockEvents.rightClicked('goety:pithos',event =>{
  const{player,block,server}=event;
  const x=block.x;const y=block.y;const z=block.z;
  if(player.getMainHandItem() === 'goety:soul_ruby'){
    server.runCommandSilent(`setblock ${x} ${y} ${z} goety:pithos`)
    player.mainHandItem.setCount(player.mainHandItem.count-1)
    event.cancel()
  }
});
//////////////////////////////分割线///////////////////////
//血魔法
ServerEvents.recipes(event =>{
  const rtoollist = [['bloodmagic:soulsword','goety:dark_sword'],
  ['bloodmagic:soulaxe','goety:dark_axe'],
  ['bloodmagic:soulpickaxe','goety:dark_pickaxe'],
  ['bloodmagic:soulshovel','goety:dark_shovel'],
  ['bloodmagic:soulscythe','goety:dark_hoe']]
  rtoollist.forEach(item =>{
    event.custom({
      "type": "bloodmagic:soulforge",
      "drain": 0.0,
      "input0": {"item": "bloodmagic:soulgempetty"},
      "input1": {"item": item[1]},
      "minimumDrain": 0.0,
      "output": {
        "item": item[0],
        "nbt": "{Damage:0}"
      }});
  })
    //血魔法空白石板
    event.custom(
      {
        "type": "bloodmagic:altar",
        "altarSyphon": 1000,
        "consumptionRate": 5,
        "drainRate": 5,
        "input": {
          "item": "goety:shade_stone"
        },
        "output": {
          "item": "bloodmagic:blankslate"
        },
        "upgradeLevel": 1
      })
    event.remove({output:'bloodmagic:soulsword',type:'bloodmagic:soulforge'})
    event.remove({output:'bloodmagic:soulaxe',type:'bloodmagic:soulforge'})
    event.remove({output:'bloodmagic:soulpickaxe',type:'bloodmagic:soulforge'})
    event.remove({output:'bloodmagic:soulshovels',type:'bloodmagic:soulforge'})
    event.remove({output:'bloodmagic:soulshoes',type:'bloodmagic:soulforge'})
    //血命果
    event.custom(
    {
      "type": "thermal:insolator",
      "ingredient": {
        "item": "bloodmagic:weak_tau"
      },
      "result": [
        {
          "item": "bloodmagic:weak_tau",
          "chance": 3.0
        },
        {
          "item": "bloodmagic:strong_tau",
          "chance": 0.1
        }
      ],
      "energy_mod": 3.0,
      "water_mod": 3.0
    })
    //血之祭坛
    event.remove({output:'bloodmagic:altar'})
    event.shaped(
      Item.of('bloodmagic:altar', 1), 
      [
        'D D',
        'DBD', 
        'ACA'
      ],
      {
        A: 'goety:shade_stone_chiseled',
        B: 'create:fluid_tank',  
        C: 'goety:hunger_core',
        D: 'tfc:metal/sheet/gold'
      })
  //血魔法升级
event.custom({
  type: 'minecraft:crafting_shaped',
  pattern: [
    ' X ',
    'YZY',
    ' W '
  ],
  key: {
    X: { item: 'bloodmagic:reinforcedslate' },
    Y: { tag: 'forge:gems/amethyst' },
    Z: { item: 'bloodmagic:blankrune' },
    W: { item: 'bloodmagic:apprenticebloodorb', keep: true } // 使用 keep
  },
  result: {
    item: 'kubejs:rune_of_level'
  }
});
event.custom(
  {
    "type": "bloodmagic:altar",
    "altarSyphon": 5000,
    "consumptionRate": 20,
    "drainRate": 20,
    "input": {
      "item": "kubejs:rune_of_level"
    },
    "output": {
      "item": "kubejs:rune_of_level2"
    },
    "upgradeLevel": 1
  })
  // Level 1 符文列表
  const runesLevel1 = [
    'bloodmagic:selfsacrificerune',
    'bloodmagic:chargingrune',
    'bloodmagic:sacrificerune',
    'bloodmagic:speedrune',
    'bloodmagic:orbcapacityrune',
    'bloodmagic:dislocationrune',
    'bloodmagic:bettercapacityrune',
    'bloodmagic:altarcapacityrune',
    'bloodmagic:accelerationrune'
  ];

  // Level 2 符文列表
  const runesLevel2 = [
    'bloodmagic:speedrune2',
    'bloodmagic:sacrificerune2',
    'bloodmagic:selfsacrificerune2',
    'bloodmagic:dislocationrune2',
    'bloodmagic:altarcapacityrune2',
    'bloodmagic:bettercapacityrune2',
    'bloodmagic:orbcapacityrune2',
    'bloodmagic:accelerationrune2',
    'bloodmagic:chargingrune2'
  ];

// 为 Level 1 符文添加配方
  runesLevel1.forEach(rune => {
    event.shapeless('kubejs:rune_of_level', [rune]);
  });

  // 为 Level 2 符文添加配方
  runesLevel2.forEach(rune => {
    event.shapeless('kubejs:rune_of_level2', [rune]);
  });
    const itemsToRemove = ['bloodmagic:selfsacrificerune', 'bloodmagic:chargingrune','bloodmagic:sacrificerune','bloodmagic:speedrune','bloodmagic:orbcapacityrune','bloodmagic:dislocationrune',
      'bloodmagic:bettercapacityrune','bloodmagic:altarcapacityrune','bloodmagic:accelerationrune','bloodmagic:speedrune2','bloodmagic:sacrificerune2','bloodmagic:selfsacrificerune2','bloodmagic:dislocationrune2',
      'bloodmagic:altarcapacityrune2','bloodmagic:bettercapacityrune2','bloodmagic:orbcapacityrune2','bloodmagic:accelerationrune2','bloodmagic:chargingrune2'
    ];

  itemsToRemove.forEach(item => {
    event.remove({ output: item }); // 移除所有输出为该物品的配方
  });

    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:sacrificerune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:speedrune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:selfsacrificerune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:dislocationrune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:altarcapacityrune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:bettercapacityrune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:orbcapacityrune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:accelerationrune2'});
    event.remove({ type: 'bloodmagic:arc', input: 'bloodmagic:chargingrune2'});


    event.stonecutting('bloodmagic:selfsacrificerune', 'kubejs:rune_of_level');
    event.stonecutting('bloodmagic:chargingrune', 'kubejs:rune_of_level');
    event.stonecutting('bloodmagic:sacrificerune', 'kubejs:rune_of_level');
    event.stonecutting('bloodmagic:speedrune', 'kubejs:rune_of_level');
    event.stonecutting('bloodmagic:speedrune2', 'kubejs:rune_of_level2');
    event.stonecutting('bloodmagic:sacrificerune2', 'kubejs:rune_of_level2');
    event.stonecutting('bloodmagic:selfsacrificerune2', 'kubejs:rune_of_level2');
    event.stonecutting('bloodmagic:chargingrune2', 'kubejs:rune_of_level2');

})